package org.example.manage.impl;

import org.example.dto.Doctor;
import org.example.manage.DoctorManage;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@Component
public class DoctorManageImpl implements DoctorManage {


    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    @Override
    public Long deleteCacheAll(List<String> keys) {
          return  redisTemplate.delete(keys);
    }

    @Override
    public void addDoctor(Map<String,Doctor> map) {
            redisTemplate.opsForValue().multiSetIfAbsent(map);
    }

    @Override
    public Doctor queryDoctor(String key) {

        return (Doctor)redisTemplate.opsForValue().get(key);
    }

}
